/**
 * PinMealActivity.java
 * Copyright2011 PinMeal
 */
package com.pinmeal;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
/**
 * @author albertma 
 * Jul 9, 2011
 */
public class PinMealActivity extends TabActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if(!checkAccountExsited())
        {
            redirectToLoginActivity();
        }
        else
        {
            loginAutomatically();
        }
        setContentView(R.layout.main);
        initTabWindow();
    }

    private void initTabWindow()
    {
        Resources res = this.getResources();
        
        TabHost.TabSpec spec = null;
        TabHost tabHost = this.getTabHost();
        
        Intent checkOutIntent = new Intent(this, CheckOutActivity.class);
        String checkOutName = res.getString(R.string.check_out);
        TabHost.TabSpec checkOutSpec = tabHost.newTabSpec(checkOutName).setIndicator(checkOutName, null).setContent(checkOutIntent);
        tabHost.addTab(checkOutSpec);
        
        Intent findFriendIntent = new Intent(this, FindFriendsActivity.class);
        String findFriendName = res.getString(R.string.find_friend_view);
        spec = tabHost.newTabSpec(findFriendName).setIndicator(findFriendName, null).setContent(findFriendIntent);
        tabHost.addTab(spec);
        
        tabHost.setCurrentTab(0);
        
    }
  
    private void loginAutomatically()
    {
        
    }

    private void redirectToLoginActivity()
    {
        // TODO Auto-generated method stub
        
    }

    private boolean checkAccountExsited()
    {

        return true;
    }
}

